XTimeCoord *xcoords;
GdkTimeCoord **coords;
GdkWindow *impl_window;
+ GdkWindowImplX11 *impl;
int tmp_n_events;
int i, j;
impl_window = _gdk_window_get_impl_window (window);
+ impl = GDK_WINDOW_IMPL_X11 (impl_window->impl);
xcoords = XGetMotionEvents (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (impl_window),
start, stop, &tmp_n_events);
for (i = 0, j = 0; i < tmp_n_events; i++)
{
- if (impl_coord_in_window (window, xcoords[i].x, xcoords[i].y))
+ if (impl_coord_in_window (window,
+ xcoords[i].x / impl->window_scale,
+ xcoords[i].y / impl->window_scale))
{
coords[j]->time = xcoords[i].time;
- coords[j]->axes[0] = xcoords[i].x - window->abs_x;
- coords[j]->axes[1] = xcoords[i].y - window->abs_y;
+ coords[j]->axes[0] = (double)xcoords[i].x / impl->window_scale - window->abs_x;
+ coords[j]->axes[1] = (double)xcoords[i].y / impl->window_scale - window->abs_y;
j++;
}
}
{
gint x_int, y_int;
+ /* TODO: This rounds the coords, should use double */
gdk_window_get_device_position (window, device, &x_int, &y_int, mask);
if (axes)
xdisplay = GDK_DISPLAY_XDISPLAY (gdk_device_get_display (device));
dest = GDK_WINDOW_XID (gdk_screen_get_root_window (screen));
- XWarpPointer (xdisplay, None, dest, 0, 0, 0, 0, x, y);
+ XWarpPointer (xdisplay, None, dest, 0, 0, 0, 0,
+ x * GDK_X11_SCREEN (screen)->window_scale,
+ y * GDK_X11_SCREEN (screen)->window_scale);
}
static void
gint *win_y,
GdkModifierType *mask)
{
+ GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl);
GdkDisplay *display;
GdkScreen *default_screen;
Window xroot_window, xchild_window;
*child_window = gdk_x11_window_lookup_for_display (display, xchild_window);
if (root_x)
- *root_x = xroot_x;
+ *root_x = xroot_x / impl->window_scale;
if (root_y)
- *root_y = xroot_y;
+ *root_y = xroot_y / impl->window_scale;
if (win_x)
- *win_x = xwin_x;
+ *win_x = xwin_x / impl->window_scale;
if (win_y)
- *win_y = xwin_y;
+ *win_y = xwin_y / impl->window_scale;
if (mask)
*mask = xmask;
GdkModifierType *mask,
gboolean get_toplevel)
{
+ GdkWindowImplX11 *impl;
GdkDisplay *display;
GdkScreen *screen;
Display *xdisplay;
for (list = toplevels; list != NULL; list = g_list_next (list))
{
window = GDK_WINDOW (list->data);
+ impl = GDK_WINDOW_IMPL_X11 (window->impl);
xwindow = GDK_WINDOW_XID (window);
gdk_x11_display_error_trap_push (display);
XQueryPointer (xdisplay, xwindow,
break;
}
gdk_window_get_geometry (window, NULL, NULL, &width, &height);
- if (winx >= 0 && winy >= 0 && winx < width && winy < height)
+ if (winx >= 0 && winy >= 0 && winx < width * impl->window_scale && winy < height * impl->window_scale)
{
/* A childless toplevel, or below another window? */
XSetWindowAttributes attributes;
gdk_x11_display_ungrab (display);
window = gdk_x11_window_lookup_for_display (display, last);
+ impl = NULL;
+ if (window)
+ impl = GDK_WINDOW_IMPL_X11 (window->impl);
if (win_x)
- *win_x = (window) ? xwin_x : -1;
+ *win_x = (window) ? xwin_x / impl->window_scale : -1;
if (win_y)
- *win_y = (window) ? xwin_y : -1;
+ *win_y = (window) ? xwin_y / impl->window_scale : -1;
if (mask)
*mask = xmask;
XIWarpPointer (GDK_SCREEN_XDISPLAY (screen),
device_xi2->device_id,
None, dest,
- 0, 0, 0, 0, x, y);
+ 0, 0, 0, 0,
+ x * GDK_X11_SCREEN(screen)->window_scale,
+ y * GDK_X11_SCREEN(screen)->window_scale);
}
static void
gint *win_y,
GdkModifierType *mask)
{
+ GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl);
GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device);
GdkDisplay *display;
GdkScreen *default_screen;
*child_window = gdk_x11_window_lookup_for_display (display, xchild_window);
if (root_x)
- *root_x = (gint) xroot_x;
+ *root_x = (gint) (xroot_x / impl->window_scale);
if (root_y)
- *root_y = (gint) xroot_y;
+ *root_y = (gint) (xroot_y / impl->window_scale);
if (win_x)
- *win_x = (gint) xwin_x;
+ *win_x = (gint) (xwin_x / impl->window_scale);
if (win_y)
- *win_y = (gint) xwin_y;
+ *win_y = (gint) (xwin_y / impl->window_scale);
if (mask)
*mask = _gdk_x11_device_xi2_translate_state (&mod_state, &button_state, &group_state);
GdkModifierType *mask,
gboolean get_toplevel)
{
+ GdkWindowImplX11 *impl;
GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device);
GdkDisplay *display;
GdkScreen *screen;
gdk_x11_display_ungrab (display);
window = gdk_x11_window_lookup_for_display (display, last);
+ impl = NULL;
+ if (window)
+ impl = GDK_WINDOW_IMPL_X11 (window->impl);
if (win_x)
- *win_x = (window) ? (gint) xwin_x : -1;
+ *win_x = (window) ? (gint) (xwin_x / impl->window_scale) : -1;
if (win_y)
- *win_y = (window) ? (gint) xwin_y : -1;
+ *win_y = (window) ? (gint) (xwin_y / impl->window_scale) : -1;
if (mask)
*mask = _gdk_x11_device_xi2_translate_state (&mod_state, &button_state, &group_state);
GdkEvent *event,
XEvent *xevent)
{
+ GdkWindowImplX11 *impl;
GdkX11DeviceManagerCore *device_manager;
GdkWindow *window;
gboolean return_val;
+ int scale;
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
device_manager = GDK_X11_DEVICE_MANAGER_CORE (translator);
window = get_event_window (translator, xevent);
+ scale = 1;
if (window)
{
if (GDK_WINDOW_DESTROYED (window) || !GDK_IS_WINDOW (window))
return FALSE;
g_object_ref (window);
+ impl = GDK_WINDOW_IMPL_X11 (window->impl);
+ scale = impl->window_scale;
}
+
event->any.window = window;
event->any.send_event = xevent->xany.send_event ? TRUE : FALSE;
event->scroll.window = window;
event->scroll.time = xevent->xbutton.time;
- event->scroll.x = (gdouble) xevent->xbutton.x;
- event->scroll.y = (gdouble) xevent->xbutton.y;
- event->scroll.x_root = (gdouble) xevent->xbutton.x_root;
- event->scroll.y_root = (gdouble) xevent->xbutton.y_root;
+ event->scroll.x = (gdouble) xevent->xbutton.x / scale;
+ event->scroll.y = (gdouble) xevent->xbutton.y / scale;
+ event->scroll.x_root = (gdouble) xevent->xbutton.x_root / scale;
+ event->scroll.y_root = (gdouble) xevent->xbutton.y_root / scale;
event->scroll.state = (GdkModifierType) xevent->xbutton.state;
event->scroll.device = device_manager->core_pointer;
event->button.type = GDK_BUTTON_PRESS;
event->button.window = window;
event->button.time = xevent->xbutton.time;
- event->button.x = (gdouble) xevent->xbutton.x;
- event->button.y = (gdouble) xevent->xbutton.y;
- event->button.x_root = (gdouble) xevent->xbutton.x_root;
- event->button.y_root = (gdouble) xevent->xbutton.y_root;
+ event->button.x = (gdouble) xevent->xbutton.x / scale;
+ event->button.y = (gdouble) xevent->xbutton.y / scale;
+ event->button.x_root = (gdouble) xevent->xbutton.x_root / scale;
+ event->button.y_root = (gdouble) xevent->xbutton.y_root / scale;
event->button.axes = NULL;
event->button.state = (GdkModifierType) xevent->xbutton.state;
event->button.button = xevent->xbutton.button;
event->button.type = GDK_BUTTON_RELEASE;
event->button.window = window;
event->button.time = xevent->xbutton.time;
- event->button.x = (gdouble) xevent->xbutton.x;
- event->button.y = (gdouble) xevent->xbutton.y;
- event->button.x_root = (gdouble) xevent->xbutton.x_root;
- event->button.y_root = (gdouble) xevent->xbutton.y_root;
+ event->button.x = (gdouble) xevent->xbutton.x / scale;
+ event->button.y = (gdouble) xevent->xbutton.y / scale;
+ event->button.x_root = (gdouble) xevent->xbutton.x_root / scale;
+ event->button.y_root = (gdouble) xevent->xbutton.y_root / scale;
event->button.axes = NULL;
event->button.state = (GdkModifierType) xevent->xbutton.state;
event->button.button = xevent->xbutton.button;
event->motion.type = GDK_MOTION_NOTIFY;
event->motion.window = window;
event->motion.time = xevent->xmotion.time;
- event->motion.x = (gdouble) xevent->xmotion.x;
- event->motion.y = (gdouble) xevent->xmotion.y;
- event->motion.x_root = (gdouble) xevent->xmotion.x_root;
- event->motion.y_root = (gdouble) xevent->xmotion.y_root;
+ event->motion.x = (gdouble) xevent->xmotion.x / scale;
+ event->motion.y = (gdouble) xevent->xmotion.y / scale;
+ event->motion.x_root = (gdouble) xevent->xmotion.x_root / scale;
+ event->motion.y_root = (gdouble) xevent->xmotion.y_root / scale;
event->motion.axes = NULL;
event->motion.state = (GdkModifierType) xevent->xmotion.state;
event->motion.is_hint = xevent->xmotion.is_hint;
event->crossing.subwindow = NULL;
event->crossing.time = xevent->xcrossing.time;
- event->crossing.x = (gdouble) xevent->xcrossing.x;
- event->crossing.y = (gdouble) xevent->xcrossing.y;
- event->crossing.x_root = (gdouble) xevent->xcrossing.x_root;
- event->crossing.y_root = (gdouble) xevent->xcrossing.y_root;
+ event->crossing.x = (gdouble) xevent->xcrossing.x / scale;
+ event->crossing.y = (gdouble) xevent->xcrossing.y / scale;
+ event->crossing.x_root = (gdouble) xevent->xcrossing.x_root / scale;
+ event->crossing.y_root = (gdouble) xevent->xcrossing.y_root / scale;
event->crossing.mode = translate_crossing_mode (xevent->xcrossing.mode);
event->crossing.detail = translate_notify_type (xevent->xcrossing.detail);
event->crossing.subwindow = NULL;
event->crossing.time = xevent->xcrossing.time;
- event->crossing.x = (gdouble) xevent->xcrossing.x;
- event->crossing.y = (gdouble) xevent->xcrossing.y;
- event->crossing.x_root = (gdouble) xevent->xcrossing.x_root;
- event->crossing.y_root = (gdouble) xevent->xcrossing.y_root;
+ event->crossing.x = (gdouble) xevent->xcrossing.x / scale;
+ event->crossing.y = (gdouble) xevent->xcrossing.y / scale;
+ event->crossing.x_root = (gdouble) xevent->xcrossing.x_root / scale;
+ event->crossing.y_root = (gdouble) xevent->xcrossing.y_root / scale;
event->crossing.mode = translate_crossing_mode (xevent->xcrossing.mode);
event->crossing.detail = translate_notify_type (xevent->xcrossing.detail);
XGenericEventCookie *cookie;
gboolean return_val = TRUE;
GdkWindow *window;
+ GdkWindowImplX11 *impl;
+ int scale;
XIEvent *ev;
device_manager = (GdkX11DeviceManagerXI2 *) translator;
if (window && GDK_WINDOW_DESTROYED (window))
return FALSE;
+ scale = 1;
+ if (window)
+ {
+ impl = GDK_WINDOW_IMPL_X11 (window->impl);
+ scale = impl->window_scale;
+ }
+
if (ev->evtype == XI_Motion ||
ev->evtype == XI_ButtonRelease)
{
event->scroll.window = window;
event->scroll.time = xev->time;
- event->scroll.x = (gdouble) xev->event_x;
- event->scroll.y = (gdouble) xev->event_y;
- event->scroll.x_root = (gdouble) xev->root_x;
- event->scroll.y_root = (gdouble) xev->root_y;
+ event->scroll.x = (gdouble) xev->event_x / scale;
+ event->scroll.y = (gdouble) xev->event_y / scale;
+ event->scroll.x_root = (gdouble) xev->root_x / scale;
+ event->scroll.y_root = (gdouble) xev->root_y / scale;
event->scroll.delta_x = 0;
event->scroll.delta_y = 0;
event->button.window = window;
event->button.time = xev->time;
- event->button.x = (gdouble) xev->event_x;
- event->button.y = (gdouble) xev->event_y;
- event->button.x_root = (gdouble) xev->root_x;
- event->button.y_root = (gdouble) xev->root_y;
+ event->button.x = (gdouble) xev->event_x / scale;
+ event->button.y = (gdouble) xev->event_y / scale;
+ event->button.x_root = (gdouble) xev->root_x / scale;
+ event->button.y_root = (gdouble) xev->root_y / scale;
event->button.device = g_hash_table_lookup (device_manager->id_table,
GUINT_TO_POINTER (xev->deviceid));
event->scroll.window = window;
event->scroll.time = xev->time;
- event->scroll.x = (gdouble) xev->event_x;
- event->scroll.y = (gdouble) xev->event_y;
- event->scroll.x_root = (gdouble) xev->root_x;
- event->scroll.y_root = (gdouble) xev->root_y;
+ event->scroll.x = (gdouble) xev->event_x / scale;
+ event->scroll.y = (gdouble) xev->event_y / scale;
+ event->scroll.x_root = (gdouble) xev->root_x / scale;
+ event->scroll.y_root = (gdouble) xev->root_y / scale;
event->scroll.delta_x = delta_x;
event->scroll.delta_y = delta_y;
event->motion.type = GDK_MOTION_NOTIFY;
event->motion.window = window;
event->motion.time = xev->time;
- event->motion.x = (gdouble) xev->event_x;
- event->motion.y = (gdouble) xev->event_y;
- event->motion.x_root = (gdouble) xev->root_x;
- event->motion.y_root = (gdouble) xev->root_y;
+ event->motion.x = (gdouble) xev->event_x / scale;
+ event->motion.y = (gdouble) xev->event_y / scale;
+ event->motion.x_root = (gdouble) xev->root_x / scale;
+ event->motion.y_root = (gdouble) xev->root_y / scale;
event->motion.device = device;
gdk_event_set_source_device (event, source_device);
event->touch.window = window;
event->touch.time = xev->time;
- event->touch.x = (gdouble) xev->event_x;
- event->touch.y = (gdouble) xev->event_y;
- event->touch.x_root = (gdouble) xev->root_x;
- event->touch.y_root = (gdouble) xev->root_y;
+ event->touch.x = (gdouble) xev->event_x / scale;
+ event->touch.y = (gdouble) xev->event_y / scale;
+ event->touch.x_root = (gdouble) xev->root_x / scale;
+ event->touch.y_root = (gdouble) xev->root_y / scale;
event->touch.device = g_hash_table_lookup (device_manager->id_table,
GUINT_TO_POINTER (xev->deviceid));
event->touch.sequence = GUINT_TO_POINTER (xev->detail);
event->touch.type = GDK_TOUCH_UPDATE;
event->touch.time = xev->time;
- event->touch.x = (gdouble) xev->event_x;
- event->touch.y = (gdouble) xev->event_y;
- event->touch.x_root = (gdouble) xev->root_x;
- event->touch.y_root = (gdouble) xev->root_y;
+ event->touch.x = (gdouble) xev->event_x / scale;
+ event->touch.y = (gdouble) xev->event_y / scale;
+ event->touch.x_root = (gdouble) xev->root_x / scale;
+ event->touch.y_root = (gdouble) xev->root_y / scale;
event->touch.device = g_hash_table_lookup (device_manager->id_table,
GINT_TO_POINTER (xev->deviceid));
event->crossing.type = (ev->evtype == XI_Enter) ? GDK_ENTER_NOTIFY : GDK_LEAVE_NOTIFY;
- event->crossing.x = (gdouble) xev->event_x;
- event->crossing.y = (gdouble) xev->event_y;
- event->crossing.x_root = (gdouble) xev->root_x;
- event->crossing.y_root = (gdouble) xev->root_y;
+ event->crossing.x = (gdouble) xev->event_x / scale;
+ event->crossing.y = (gdouble) xev->event_y / scale;
+ event->crossing.x_root = (gdouble) xev->root_x / scale;
+ event->crossing.y_root = (gdouble) xev->root_y / scale;
event->crossing.time = xev->time;
event->crossing.focus = xev->focus;
{
GdkRectangle expose_rect;
+ int x2, y2;
- expose_rect.x = xevent->xexpose.x;
- expose_rect.y = xevent->xexpose.y;
- expose_rect.width = xevent->xexpose.width;
- expose_rect.height = xevent->xexpose.height;
+ expose_rect.x = xevent->xexpose.x / window_impl->window_scale;
+ expose_rect.y = xevent->xexpose.y / window_impl->window_scale;
+
+ x2 = (xevent->xexpose.x + xevent->xexpose.width + window_impl->window_scale -1) / window_impl->window_scale;
+ expose_rect.width = x2 - expose_rect.x;
+
+ y2 = (xevent->xexpose.y + xevent->xexpose.height + window_impl->window_scale -1) / window_impl->window_scale;
+ expose_rect.height = y2 - expose_rect.y;
_gdk_x11_window_process_expose (window, xevent->xexpose.serial, &expose_rect);
return_val = FALSE;
case GraphicsExpose:
{
GdkRectangle expose_rect;
+ int x2, y2;
GDK_NOTE (EVENTS,
g_message ("graphics expose:\tdrawable: %ld",
break;
}
- expose_rect.x = xevent->xgraphicsexpose.x;
- expose_rect.y = xevent->xgraphicsexpose.y;
- expose_rect.width = xevent->xgraphicsexpose.width;
- expose_rect.height = xevent->xgraphicsexpose.height;
+ expose_rect.x = xevent->xgraphicsexpose.x / window_impl->window_scale;
+ expose_rect.y = xevent->xgraphicsexpose.y / window_impl->window_scale;
+
+ x2 = (xevent->xgraphicsexpose.x + xevent->xgraphicsexpose.width + window_impl->window_scale -1) / window_impl->window_scale;
+ expose_rect.width = x2 - expose_rect.x;
+
+ y2 = (xevent->xgraphicsexpose.y + xevent->xgraphicsexpose.height + window_impl->window_scale -1) / window_impl->window_scale;
+ expose_rect.height = y2 - expose_rect.y;
_gdk_x11_window_process_expose (window, xevent->xgraphicsexpose.serial, &expose_rect);
return_val = FALSE;
: ""));
if (window && GDK_WINDOW_TYPE (window) == GDK_WINDOW_ROOT)
{
- window->width = xevent->xconfigure.width;
- window->height = xevent->xconfigure.height;
+ window->width = xevent->xconfigure.width / window_impl->window_scale;
+ window->height = xevent->xconfigure.height / window_impl->window_scale;
_gdk_window_update_size (window);
_gdk_x11_window_update_size (GDK_WINDOW_IMPL_X11 (window->impl));
{
event->configure.type = GDK_CONFIGURE;
event->configure.window = window;
- event->configure.width = xevent->xconfigure.width;
- event->configure.height = xevent->xconfigure.height;
+ event->configure.width = xevent->xconfigure.width / window_impl->window_scale;
+ event->configure.height = xevent->xconfigure.height / window_impl->window_scale;
if (!xevent->xconfigure.send_event &&
!xevent->xconfigure.override_redirect &&
&tx, &ty,
&child_window))
{
- event->configure.x = tx;
- event->configure.y = ty;
+ event->configure.x = tx / window_impl->window_scale;
+ event->configure.y = ty / window_impl->window_scale;
}
gdk_x11_display_error_trap_pop_ignored (display);
}
else
{
- event->configure.x = xevent->xconfigure.x;
- event->configure.y = xevent->xconfigure.y;
+ event->configure.x = xevent->xconfigure.x / window_impl->window_scale;
+ event->configure.y = xevent->xconfigure.y / window_impl->window_scale;
}
if (!is_substructure)
{
window->x = event->configure.x;
window->y = event->configure.y;
- window->width = xevent->xconfigure.width;
- window->height = xevent->xconfigure.height;
+ window->width = xevent->xconfigure.width / window_impl->window_scale;
+ window->height = xevent->xconfigure.height / window_impl->window_scale;
_gdk_window_update_size (window);
_gdk_x11_window_update_size (GDK_WINDOW_IMPL_X11 (window->impl));
XDamageNotifyEvent *damage_event = (XDamageNotifyEvent *) xevent;
XserverRegion repair;
GdkRectangle rect;
+ int x2, y2;
+
+ rect.x = window->x + damage_event->area.x / window_impl->window_scale;
+ rect.y = window->y + damage_event->area.y / window_impl->window_scale;
- rect.x = window->x + damage_event->area.x;
- rect.y = window->y + damage_event->area.y;
- rect.width = damage_event->area.width;
- rect.height = damage_event->area.height;
+ x2 = (rect.x * window_impl->window_scale + damage_event->area.width + window_impl->window_scale -1) / window_impl->window_scale;
+ y2 = (rect.y * window_impl->window_scale + damage_event->area.height + window_impl->window_scale -1) / window_impl->window_scale;
+ rect.width = x2 - rect.x;
+ rect.height = y2 - rect.y;
repair = XFixesCreateRegion (display_x11->xdisplay,
&damage_event->area, 1);
{
GList *toplevel_windows, *list;
GdkWindow *window;
+ GdkWindowImplX11 *impl;
gint x, y, width, height;
toplevel_windows = gdk_screen_get_toplevel_windows (screen);
for (list = toplevel_windows; list; list = list->next)
{
window = GDK_WINDOW (list->data);
+ impl = GDK_WINDOW_IMPL_X11 (window->impl);
gdk_window_get_geometry (window, &x, &y, &width, &height);
gdk_window_cache_add (result, GDK_WINDOW_XID (window),
- x, y, width, height,
+ x * impl->window_scale, y * impl->window_scale,
+ width * impl->window_scale,
+ height * impl->window_scale,
gdk_window_is_visible (window));
}
g_list_free (toplevel_windows);
if (gdk_screen_is_composited (screen))
{
cow = XCompositeGetOverlayWindow (xdisplay, GDK_WINDOW_XID (root_window));
- gdk_window_cache_add (result, cow, 0, 0, gdk_screen_get_width (screen), gdk_screen_get_height (screen), TRUE);
+ gdk_window_cache_add (result, cow, 0, 0,
+ gdk_screen_get_width (screen) * GDK_X11_SCREEN(screen)->window_scale,
+ gdk_screen_get_height (screen) * GDK_X11_SCREEN(screen)->window_scale,
+ TRUE);
XCompositeReleaseOverlayWindow (xdisplay, GDK_WINDOW_XID (root_window));
}
#endif
child->shape = NULL;
if (gdk_display_supports_shapes (display))
child->shape = _gdk_x11_xwindow_get_shape (display_x11->xdisplay,
- child->xid, ShapeBounding);
+ child->xid, 1, ShapeBounding);
#ifdef ShapeInput
input_shape = NULL;
if (gdk_display_supports_input_shapes (display))
input_shape = _gdk_x11_xwindow_get_shape (display_x11->xdisplay,
- child->xid, ShapeInput);
+ child->xid, 1, ShapeInput);
if (child->shape && input_shape)
{
GdkEvent *event,
gpointer data)
{
+ GdkWindowImplX11 *impl;
XEvent *xevent = (XEvent *)xev;
guint32 source_window = xevent->xclient.data.l[0];
gint16 x_root = xevent->xclient.data.l[2] >> 16;
(context->protocol == GDK_DRAG_PROTO_XDND) &&
(GDK_WINDOW_XID (context->source_window) == source_window))
{
+ impl = GDK_WINDOW_IMPL_X11 (event->any.window->impl);
+
context_x11 = GDK_X11_DRAG_CONTEXT (context);
event->dnd.type = GDK_DRAG_MOTION;
if (!context_x11->xdnd_have_actions)
context->actions = context->suggested_action;
- event->dnd.x_root = x_root;
- event->dnd.y_root = y_root;
+ event->dnd.x_root = x_root / impl->window_scale;
+ event->dnd.y_root = y_root / impl->window_scale;
- context_x11->last_x = x_root;
- context_x11->last_y = y_root;
+ context_x11->last_x = x_root / impl->window_scale;
+ context_x11->last_y = y_root / impl->window_scale;
return GDK_FILTER_TRANSLATE;
}
gint y_root,
GdkDragProtocol *protocol)
{
+ GdkX11Screen *screen_x11 = GDK_X11_SCREEN(screen);
GdkX11DragContext *context_x11 = GDK_X11_DRAG_CONTEXT (context);
GdkWindowCache *window_cache;
GdkDisplay *display;
dest = get_client_window_at_coords (window_cache,
drag_window && GDK_WINDOW_IS_X11 (drag_window) ?
GDK_WINDOW_XID (drag_window) : None,
- x_root, y_root);
+ x_root * screen_x11->window_scale,
+ y_root * screen_x11->window_scale);
if (context_x11->dest_xid != dest)
{
guint32 time)
{
GdkX11DragContext *context_x11 = GDK_X11_DRAG_CONTEXT (context);
+ GdkWindowImplX11 *impl;
context_x11->old_actions = context->actions;
context->actions = possible_actions;
if (context->dest_window)
{
+ impl = GDK_WINDOW_IMPL_X11 (context->dest_window->impl);
+
if (context_x11->drag_status == GDK_DRAG_STATUS_DRAG)
{
switch (context->protocol)
{
case GDK_DRAG_PROTO_XDND:
- xdnd_send_motion (context_x11, x_root, y_root, suggested_action, time);
+ xdnd_send_motion (context_x11, x_root * impl->window_scale, y_root * impl->window_scale, suggested_action, time);
break;
case GDK_DRAG_PROTO_ROOTWIN:
gint width,
gint height)
{
+ GdkWindowImplX11 *impl;
+
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (width > 65535 ||
- height > 65535)
+ impl = GDK_WINDOW_IMPL_X11 (window->impl);
+
+ if (width * impl->window_scale > 65535 ||
+ height * impl->window_scale > 65535)
{
g_warning ("Native children wider or taller than 65535 pixels are not supported");
- if (width > 65535)
- width = 65535;
- if (height > 65535)
- height = 65535;
+ if (width * impl->window_scale > 65535)
+ width = 65535 / impl->window_scale;
+ if (height * impl->window_scale > 65535)
+ height = 65535 / impl->window_scale;
}
window->x = x;
_gdk_x11_window_tmp_unset_bg (window, TRUE);
XMoveResizeWindow (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
- window->x + window->parent->abs_x,
- window->y + window->parent->abs_y,
- width, height);
+ (window->x + window->parent->abs_x) * impl->window_scale,
+ (window->y + window->parent->abs_y) * impl->window_scale,
+ width * impl->window_scale,
+ height * impl->window_scale);
_gdk_x11_window_tmp_reset_parent_bg (window);
_gdk_x11_window_tmp_reset_bg (window, TRUE);
}
_gdk_x11_region_get_xrectangles (const cairo_region_t *region,
gint x_offset,
gint y_offset,
+ gint scale,
XRectangle **rects,
gint *n_rects)
{
for (i = 0; i < n; i++)
{
cairo_region_get_rectangle (region, i, &box);
- rectangles[i].x = CLAMP (box.x + x_offset, G_MINSHORT, G_MAXSHORT);
- rectangles[i].y = CLAMP (box.y + y_offset, G_MINSHORT, G_MAXSHORT);
- rectangles[i].width = CLAMP (box.width, G_MINSHORT, G_MAXSHORT);
- rectangles[i].height = CLAMP (box.height, G_MINSHORT, G_MAXSHORT);
+ rectangles[i].x = CLAMP ((box.x + x_offset) * scale, G_MINSHORT, G_MAXSHORT);
+ rectangles[i].y = CLAMP ((box.y + y_offset) * scale, G_MINSHORT, G_MAXSHORT);
+ rectangles[i].width = CLAMP (box.width * scale, G_MINSHORT, G_MAXSHORT);
+ rectangles[i].height = CLAMP (box.height * scale, G_MINSHORT, G_MAXSHORT);
}
*n_rects = n;
cairo_region_t* _gdk_x11_xwindow_get_shape (Display *xdisplay,
Window window,
+ gint scale,
gint shape_type);
void _gdk_x11_region_get_xrectangles (const cairo_region_t *region,
gint x_offset,
gint y_offset,
+ gint scale,
XRectangle **rects,
gint *n_rects);
static gint
gdk_x11_screen_get_width (GdkScreen *screen)
{
- return WidthOfScreen (GDK_X11_SCREEN (screen)->xscreen);
+ return WidthOfScreen (GDK_X11_SCREEN (screen)->xscreen) / GDK_X11_SCREEN (screen)->window_scale;
}
static gint
gdk_x11_screen_get_height (GdkScreen *screen)
{
- return HeightOfScreen (GDK_X11_SCREEN (screen)->xscreen);
+ return HeightOfScreen (GDK_X11_SCREEN (screen)->xscreen) / GDK_X11_SCREEN (screen)->window_scale;
}
static gint
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
if (dest)
- *dest = x11_screen->monitors[monitor_num].geometry;
+ {
+ *dest = x11_screen->monitors[monitor_num].geometry;
+ dest->x /= x11_screen->window_scale;
+ dest->y /= x11_screen->window_scale;
+ dest->width /= x11_screen->window_scale;
+ dest->height /= x11_screen->window_scale;
+ }
}
static int
get_work_area (GdkScreen *screen,
GdkRectangle *area)
{
+ GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
Atom workarea;
Atom type;
Window win;
/* Defaults in case of error */
area->x = 0;
area->y = 0;
- area->width = gdk_screen_get_width (screen);
- area->height = gdk_screen_get_height (screen);
+ area->width = gdk_screen_get_width (screen) / x11_screen->window_scale;
+ area->height = gdk_screen_get_height (screen) / x11_screen->window_scale;
if (!gdk_x11_screen_supports_net_wm_hint (screen,
gdk_atom_intern_static_string ("_NET_WORKAREA")))
area->width = workareas[desktop * 4 + 2];
area->height = workareas[desktop * 4 + 3];
+ area->x /= x11_screen->window_scale;
+ area->y /= x11_screen->window_scale;
+ area->width /= x11_screen->window_scale;
+ area->height /= x11_screen->window_scale;
+
XFree (ret_workarea);
}
}
}
+static gint
+gdk_x11_screen_get_monitor_scale_factor (GdkScreen *screen,
+ gint monitor_num)
+{
+ GdkX11Screen *screen_x11 = GDK_X11_SCREEN (screen);
+
+ return screen_x11->window_scale;
+}
+
static GdkVisual *
gdk_x11_screen_get_rgba_visual (GdkScreen *screen)
{
GdkScreen *screen;
GdkX11Screen *x11_screen;
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
+ const char *scale_str;
screen = g_object_new (GDK_TYPE_X11_SCREEN, NULL);
x11_screen->wmspec_check_window = None;
/* we want this to be always non-null */
x11_screen->window_manager_name = g_strdup ("unknown");
-
+
+#ifdef HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE
+ scale_str = g_getenv ("GDK_SCALE");
+#else
+ scale_str = NULL;
+#endif
+ if (scale_str)
+ {
+ x11_screen->window_scale = atol (scale_str);
+ if (x11_screen->window_scale == 0)
+ x11_screen->window_scale = 1;
+ }
+ else
+ x11_screen->window_scale = 1;
+
init_multihead (screen);
init_randr_support (screen);
screen_class->get_monitor_plug_name = gdk_x11_screen_get_monitor_plug_name;
screen_class->get_monitor_geometry = gdk_x11_screen_get_monitor_geometry;
screen_class->get_monitor_workarea = gdk_x11_screen_get_monitor_workarea;
+ screen_class->get_monitor_scale_factor = gdk_x11_screen_get_monitor_scale_factor;
screen_class->get_system_visual = _gdk_x11_screen_get_system_visual;
screen_class->get_rgba_visual = gdk_x11_screen_get_rgba_visual;
screen_class->is_composited = gdk_x11_screen_is_composited;
GdkX11Monitor *monitors;
gint primary_monitor;
+ gint window_scale;
+
/* Xft resources for the display, used for default values for
* the Xft/ XSETTINGS
*/
if (impl->cairo_surface)
{
cairo_xlib_surface_set_size (impl->cairo_surface,
- gdk_window_get_width (impl->wrapper),
- gdk_window_get_height (impl->wrapper));
+ gdk_window_get_width (impl->wrapper) * impl->window_scale,
+ gdk_window_get_height (impl->wrapper) * impl->window_scale);
}
}
if (!impl->cairo_surface)
{
impl->cairo_surface = gdk_x11_create_cairo_surface (impl,
- gdk_window_get_width (window),
- gdk_window_get_height (window));
+ gdk_window_get_width (window) * impl->window_scale,
+ gdk_window_get_height (window) * impl->window_scale);
+#ifdef HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE
+ cairo_surface_set_device_scale (impl->cairo_surface, impl->window_scale, impl->window_scale);
+#endif
if (impl->cairo_surface)
cairo_surface_set_user_data (impl->cairo_surface, &gdk_x11_cairo_key,
impl->xid = x11_screen->xroot_window;
impl->wrapper = window;
+ impl->window_scale = x11_screen->window_scale;
window->window_type = GDK_WINDOW_ROOT;
window->depth = DefaultDepthOfScreen (x11_screen->xscreen);
window->y = 0;
window->abs_x = 0;
window->abs_y = 0;
- window->width = WidthOfScreen (x11_screen->xscreen);
- window->height = HeightOfScreen (x11_screen->xscreen);
+ window->width = WidthOfScreen (x11_screen->xscreen) / impl->window_scale;
+ window->height = HeightOfScreen (x11_screen->xscreen) / impl->window_scale;
window->viewable = TRUE;
/* see init_randr_support() in gdkscreen-x11.c */
GdkWindow *parent)
{
GdkToplevelX11 *toplevel = _gdk_x11_window_get_toplevel (window);
+ GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl);
GdkDisplay *display = gdk_window_get_display (window);
Display *xdisplay = GDK_WINDOW_XDISPLAY (window);
XID xid = GDK_WINDOW_XID (window);
* correct value???
*/
size_hints.flags = PSize;
- size_hints.width = window->width;
- size_hints.height = window->height;
+ size_hints.width = window->width * impl->window_scale;
+ size_hints.height = window->height * impl->window_scale;
XSetWMNormalHints (xdisplay, xid, &size_hints);
impl = g_object_new (GDK_TYPE_WINDOW_IMPL_X11, NULL);
window->impl = GDK_WINDOW_IMPL (impl);
impl->wrapper = GDK_WINDOW (window);
+ impl->window_scale = x11_screen->window_scale;
xdisplay = x11_screen->xdisplay;
class = InputOnly;
}
- if (window->width > 65535 ||
- window->height > 65535)
+ if (window->width * impl->window_scale > 65535 ||
+ window->height * impl->window_scale > 65535)
{
g_warning ("Native Windows wider or taller than 65535 pixels are not supported");
- if (window->width > 65535)
- window->width = 65535;
- if (window->height > 65535)
- window->height = 65535;
+ if (window->width * impl->window_scale > 65535)
+ window->width = 65535 / impl->window_scale;
+ if (window->height * impl->window_scale > 65535)
+ window->height = 65535 / impl->window_scale;
}
impl->xid = XCreateWindow (xdisplay, xparent,
- window->x + window->parent->abs_x,
- window->y + window->parent->abs_y,
- window->width, window->height,
+ (window->x + window->parent->abs_x) * impl->window_scale,
+ (window->y + window->parent->abs_y) * impl->window_scale,
+ window->width * impl->window_scale, window->height * impl->window_scale,
0, window->depth, class, xvisual,
xattributes_mask, &xattributes);
impl = GDK_WINDOW_IMPL_X11 (win->impl);
impl->wrapper = win;
+ impl->window_scale = GDK_X11_SCREEN (screen)->window_scale;
win->parent = gdk_x11_window_lookup_for_display (display, parent);
impl->xid = window;
- win->x = attrs.x;
- win->y = attrs.y;
- win->width = attrs.width;
- win->height = attrs.height;
+ win->x = attrs.x / impl->window_scale;
+ win->y = attrs.y / impl->window_scale;
+ win->width = attrs.width / impl->window_scale;
+ win->height = attrs.height / impl->window_scale;
win->window_type = GDK_WINDOW_FOREIGN;
win->destroyed = FALSE;
{
XMoveWindow (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
- x, y);
+ x * impl->window_scale, y * impl->window_scale);
if (impl->override_redirect)
{
XResizeWindow (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
- width, height);
+ width * impl->window_scale, height * impl->window_scale);
if (impl->override_redirect)
{
XMoveResizeWindow (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
- x, y, width, height);
+ x * impl->window_scale, y * impl->window_scale,
+ width * impl->window_scale, height * impl->window_scale);
if (impl->override_redirect)
{
XReparentWindow (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
GDK_WINDOW_XID (new_parent),
- new_parent->abs_x + x, new_parent->abs_y + y);
+ (new_parent->abs_x + x) * impl->window_scale,
+ (new_parent->abs_y + y) * impl->window_scale);
_gdk_x11_window_tmp_reset_parent_bg (window);
_gdk_x11_window_tmp_reset_bg (window, TRUE);
const GdkGeometry *geometry,
GdkWindowHints geom_mask)
{
+ GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl);
XSizeHints size_hints;
if (GDK_WINDOW_DESTROYED (window) ||
if (geom_mask & GDK_HINT_MIN_SIZE)
{
size_hints.flags |= PMinSize;
- size_hints.min_width = geometry->min_width;
- size_hints.min_height = geometry->min_height;
+ size_hints.min_width = geometry->min_width * impl->window_scale;
+ size_hints.min_height = geometry->min_height * impl->window_scale;
}
if (geom_mask & GDK_HINT_MAX_SIZE)
{
size_hints.flags |= PMaxSize;
- size_hints.max_width = MAX (geometry->max_width, 1);
- size_hints.max_height = MAX (geometry->max_height, 1);
+ size_hints.max_width = MAX (geometry->max_width, 1) * impl->window_scale;
+ size_hints.max_height = MAX (geometry->max_height, 1) * impl->window_scale;
}
if (geom_mask & GDK_HINT_BASE_SIZE)
{
size_hints.flags |= PBaseSize;
- size_hints.base_width = geometry->base_width;
- size_hints.base_height = geometry->base_height;
+ size_hints.base_width = geometry->base_width * impl->window_scale;
+ size_hints.base_height = geometry->base_height * impl->window_scale;
}
if (geom_mask & GDK_HINT_RESIZE_INC)
{
size_hints.flags |= PResizeInc;
- size_hints.width_inc = geometry->width_inc;
- size_hints.height_inc = geometry->height_inc;
+ size_hints.width_inc = geometry->width_inc * impl->window_scale;
+ size_hints.height_inc = geometry->height_inc * impl->window_scale;
}
-
+ else if (impl->window_scale > 1)
+ {
+ size_hints.flags |= PResizeInc;
+ size_hints.width_inc = impl->window_scale;
+ size_hints.height_inc = impl->window_scale;
+ }
+
if (geom_mask & GDK_HINT_ASPECT)
{
size_hints.flags |= PAspect;
GdkGeometry *geometry,
GdkWindowHints *geom_mask)
{
+ GdkWindowImplX11 *impl;
XSizeHints *size_hints;
glong junk_supplied_mask = 0;
!WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
return;
+ impl = GDK_WINDOW_IMPL_X11 (window->impl);
+
size_hints = XAllocSizeHints ();
if (!size_hints)
return;
if (size_hints->flags & PMinSize)
{
*geom_mask |= GDK_HINT_MIN_SIZE;
- geometry->min_width = size_hints->min_width;
- geometry->min_height = size_hints->min_height;
+ geometry->min_width = size_hints->min_width / impl->window_scale;
+ geometry->min_height = size_hints->min_height / impl->window_scale;
}
if (size_hints->flags & PMaxSize)
{
*geom_mask |= GDK_HINT_MAX_SIZE;
- geometry->max_width = MAX (size_hints->max_width, 1);
- geometry->max_height = MAX (size_hints->max_height, 1);
+ geometry->max_width = MAX (size_hints->max_width, 1) / impl->window_scale;
+ geometry->max_height = MAX (size_hints->max_height, 1) / impl->window_scale;
}
if (size_hints->flags & PResizeInc)
{
*geom_mask |= GDK_HINT_RESIZE_INC;
- geometry->width_inc = size_hints->width_inc;
- geometry->height_inc = size_hints->height_inc;
+ geometry->width_inc = size_hints->width_inc / impl->window_scale;
+ geometry->height_inc = size_hints->height_inc / impl->window_scale;
}
if (size_hints->flags & PAspect)
gdk_window_x11_set_background (GdkWindow *window,
cairo_pattern_t *pattern)
{
+ GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl);
double r, g, b, a;
cairo_surface_t *surface;
cairo_matrix_t matrix;
cairo_xlib_surface_get_visual (surface) == GDK_VISUAL_XVISUAL (gdk_window_get_visual ((window))) &&
cairo_xlib_surface_get_display (surface) == GDK_WINDOW_XDISPLAY (window))
{
- double x, y;
+ double x, y, sx, sy;
cairo_surface_get_device_offset (surface, &x, &y);
+ sx = sy = 1.;
+#ifdef HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE
+ cairo_surface_get_device_scale (surface, &sx, &sy);
+#endif
/* XXX: This still bombs for non-pixmaps, but there's no way to
* detect we're not a pixmap in Cairo... */
- if (x == 0.0 && y == 0.0)
+ if (x == 0.0 && y == 0.0 &&
+ sx == impl->window_scale && sy == impl->window_scale)
{
XSetWindowBackgroundPixmap (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
gint *width,
gint *height)
{
+ GdkWindowImplX11 *impl;
Window root;
gint tx;
gint ty;
if (!GDK_WINDOW_DESTROYED (window))
{
+ impl = GDK_WINDOW_IMPL_X11 (window->impl);
+
XGetGeometry (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
&root, &tx, &ty, &twidth, &theight, &tborder_width, &tdepth);
if (x)
- *x = tx;
+ *x = tx / impl->window_scale;
if (y)
- *y = ty;
+ *y = ty / impl->window_scale;
if (width)
- *width = twidth;
+ *width = twidth / impl->window_scale;
if (height)
- *height = theight;
+ *height = theight / impl->window_scale;
}
}
gint *root_x,
gint *root_y)
{
+ GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl);
gint return_val;
Window child;
gint tx;
return_val = XTranslateCoordinates (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
GDK_WINDOW_XROOTWIN (window),
- x, y, &tx, &ty,
+ x * impl->window_scale, y * impl->window_scale, &tx, &ty,
&child);
if (root_x)
- *root_x = tx;
+ *root_x = tx / impl->window_scale;
if (root_y)
- *root_y = ty;
+ *root_y = ty / impl->window_scale;
return return_val;
}
while (window->parent && (window->parent)->parent)
window = window->parent;
+ impl = GDK_WINDOW_IMPL_X11 (window->impl);
+
/* Refine our fallback answer a bit using local information */
- rect->x = window->x;
- rect->y = window->y;
- rect->width = window->width;
- rect->height = window->height;
+ rect->x = window->x * impl->window_scale;
+ rect->y = window->y * impl->window_scale;
+ rect->width = window->width * impl->window_scale;
+ rect->height = window->height * impl->window_scale;
- impl = GDK_WINDOW_IMPL_X11 (window->impl);
if (GDK_WINDOW_DESTROYED (window) || impl->override_redirect)
return;
if (vroots)
XFree (vroots);
+ rect->x /= impl->window_scale;
+ rect->y /= impl->window_scale;
+ rect->width /= impl->window_scale;
+ rect->height /= impl->window_scale;
gdk_x11_display_error_trap_pop_ignored (display);
}
if (GDK_WINDOW_DESTROYED (window))
return FALSE;
+ /*HIDPI: handle coords here?*/
GDK_DEVICE_GET_CLASS (device)->query_state (device, window,
NULL, &child,
NULL, NULL,
gint offset_y,
gint shape)
{
+ GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl);
+
if (GDK_WINDOW_DESTROYED (window))
return;
XRectangle *xrects = NULL;
_gdk_x11_region_get_xrectangles (shape_region,
- 0, 0,
+ 0, 0, impl->window_scale,
&xrects, &n_rects);
if (shape == ShapeBounding)
XShapeCombineRectangles (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
shape,
- offset_x, offset_y,
+ offset_x * impl->window_scale,
+ offset_y * impl->window_scale,
xrects, n_rects,
ShapeSet,
YXBanded);
cairo_region_t *
_gdk_x11_xwindow_get_shape (Display *xdisplay,
Window window,
+ gint scale,
gint shape_type)
{
cairo_region_t *shape;
return NULL;
}
+ /* NOTE: The scale divisions here may lose some precision if someone
+ else set the shape to be non-scale precision */
rl = g_new (GdkRectangle, rn);
for (i = 0; i < rn; i++)
{
- rl[i].x = xrl[i].x;
- rl[i].y = xrl[i].y;
- rl[i].width = xrl[i].width;
- rl[i].height = xrl[i].height;
+ rl[i].x = xrl[i].x / scale;
+ rl[i].y = xrl[i].y / scale;
+ rl[i].width = xrl[i].width / scale;
+ rl[i].height = xrl[i].height / scale;
}
XFree (xrl);
static cairo_region_t *
gdk_x11_window_get_shape (GdkWindow *window)
{
+ GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl);
+
if (!GDK_WINDOW_DESTROYED (window) &&
gdk_display_supports_shapes (GDK_WINDOW_DISPLAY (window)))
return _gdk_x11_xwindow_get_shape (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
+ impl->window_scale,
ShapeBounding);
return NULL;
gdk_x11_window_get_input_shape (GdkWindow *window)
{
#if defined(ShapeInput)
+ GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl);
+
if (!GDK_WINDOW_DESTROYED (window) &&
gdk_display_supports_input_shapes (GDK_WINDOW_DISPLAY (window)))
return _gdk_x11_xwindow_get_shape (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
+ impl->window_scale,
ShapeInput);
#endif
gint action,
gint button)
{
+ GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl);
XClientMessageEvent xclient;
memset (&xclient, 0, sizeof (xclient));
xclient.message_type =
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_MOVERESIZE");
xclient.format = 32;
- xclient.data.l[0] = root_x;
- xclient.data.l[1] = root_y;
+ xclient.data.l[0] = root_x * impl->window_scale;
+ xclient.data.l[1] = root_y * impl->window_scale;
xclient.data.l[2] = action;
xclient.data.l[3] = button;
xclient.data.l[4] = 1; /* source indication */
guint button_mask = 0;
GdkDisplay *display = gdk_x11_lookup_xdisplay (event->xany.display);
MoveResizeData *mv_resize = get_move_resize_data (display, FALSE);
+ GdkWindowImplX11 *impl;
if (!mv_resize || !mv_resize->moveresize_window)
{
return FALSE;
}
+ impl = GDK_WINDOW_IMPL_X11 (mv_resize->moveresize_window->impl);
+
button_mask = GDK_BUTTON1_MASK << (mv_resize->moveresize_button - 1);
switch (event->xany.type)
break;
update_pos (mv_resize,
- event->xmotion.x_root,
- event->xmotion.y_root);
+ event->xmotion.x_root / impl->window_scale,
+ event->xmotion.y_root / impl->window_scale);
/* This should never be triggered in normal cases, but in the
* case where the drag started without an implicit grab being
case ButtonRelease:
update_pos (mv_resize,
- event->xbutton.x_root,
- event->xbutton.y_root);
+ event->xbutton.x_root / impl->window_scale,
+ event->xbutton.y_root / impl->window_scale);
if (event->xbutton.button == mv_resize->moveresize_button)
finish_drag (mv_resize);
switch (ev->evtype)
{
case XI_Motion:
- update_pos (mv_resize, xev->root_x, xev->root_y);
+ update_pos (mv_resize, xev->root_x / impl->window_scale, xev->root_y / impl->window_scale);
state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group);
if ((state & button_mask) == 0)
finish_drag (mv_resize);
break;
case XI_ButtonRelease:
- update_pos (mv_resize, xev->root_x, xev->root_y);
+ update_pos (mv_resize, xev->root_x / impl->window_scale, xev->root_y / impl->window_scale);
if (xev->detail == mv_resize->moveresize_button)
finish_drag (mv_resize);
break;
return GDK_WINDOW_IMPL_X11 (window->impl)->xid;
}
+static gint
+gdk_x11_window_get_scale_factor (GdkWindow *window)
+{
+ GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl);
+
+ if (GDK_WINDOW_DESTROYED (window))
+ return 1;
+
+ return impl->window_scale;
+}
+
static void
gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass)
{
impl_class->get_property = _gdk_x11_window_get_property;
impl_class->change_property = _gdk_x11_window_change_property;
impl_class->delete_property = _gdk_x11_window_delete_property;
+ impl_class->get_scale_factor = gdk_x11_window_get_scale_factor;
}
Window xid;
+ gint window_scale;
+
GdkToplevelX11 *toplevel; /* Toplevel-specific information */
GdkCursor *cursor;
GHashTable *device_cursor;